//导入vue
import Vue from 'vue';
import VueRouter from 'vue-router';
import Login from "../views/Login";
import forgetMM from '../views/forgetMM';

//首页
import Home from "../views/home/home";
import Homepage from "../views/home/homepage";
import Personal_Data from "../views/home/Personal_Data";

//入孵
import Incubation from "../views/home/Incubation/Incubation";
import Incubation_application from "../views/home/Incubation/Incubation_application";
import Incubation_file from "../views/home/Incubation/Incubation_file";
import Incubation_Review_results from "../views/home/Incubation/Incubation_Review_results";
import Incubation_Settlement_agreement from "../views/home/Incubation/Incubation_Settlement_agreement";
import Incubation_Withdrawal_application from "../views/home/Incubation/Incubation_Withdrawal_application";
import Incubation_Tutor_application from "../views/home/Incubation/Incubation_Tutor_application";

//日常
import Daily from "../views/home/Daily/Daily";
import Daily_Material_Dpplication from "../views/home/Daily/Daily_Material_Dpplication";
import Daily_Conference_Room_Dpplication from "../views/home/Daily/Daily_Conference_Room_Dpplication";
import Daily_Repair_Application from "../views/home/Daily/Daily_Repair_Application";
import Daily_Activity_Management from "../views/home/Daily/Daily_Activity_Management";
import Daily_Activity_Management_Detailed from "../views/home/Daily/Daily_Activity_Management_Detailed";
import Daily_Award_Collection from "../views/home/Daily/Daily_Award_Collection";
import Daily_Feedback from "../views/home/Daily/Daily_Feedback";

//团队
import Team from "../views/home/Team/Team";
import Team_information from "../views/home/Team/Team_information";
import Team_Video_lectures from '@/views/home/Team/Team_Video_lectures'
import Team_Match_the_query from '@/views/home/Team/Team_Match_the_query'
import Team_Incubation_community from '@/views/home/Team/Team_Incubation_community'
import Team_Incubation_community_Blog_details from '@/views/home/Team/Team_Incubation_community_Blog_details'
import Team_Incubation_community_historic_records from '@/views/home/Team/Team_Incubation_community_historic_records'
import Team_Incubation_community_publish from '@/views/home/Team/Team_Incubation_community_publish'

import Team_Teacher_counsel from '@/views/home/Team/Team_Teacher_counsel'
import Team_Company_registry from '@/views/home/Team/Team_Company_registry'
import Team_Flea_market from '@/views/home/Team/Team_Flea_market '
import Team_Create_new_team from '@/views/home/Team/Team_Create_new_team'

//考核
import Check from "../views/home/check/check";
import Check_upload from "../views/home/check/check_upload";



Vue.use(VueRouter);




const router = new VueRouter({
  mode: 'hash',
  // base:"/dist",
  // mode:'history',
  routes: [
    //登录
    { path: '/', redirect: '/login', },
    { path: '/login', component: Login, name: "Login" },
    { path: '/login/forgetMM', component: forgetMM, name: "forgetMM" },
    //首页
    {
      path: '/home', component: Home,
      meta: { authRequired: true },
      redirect: "/home/homepage",
      children: [
        {
          path: "/home/homepage", component: Homepage
        },
        {
          path: "/home/Personal_Data", component: Personal_Data
        },
        //入孵
        {
          path: "/home/Incubation", component: Incubation,
          redirect: "/home/Incubation/application",
          children: [
            {
              path: "/home/Incubation/application", component: Incubation_application,

            },
            {
              path: "/home/Incubation/file", component: Incubation_file,

            },
            {
              path: "/home/Incubation/Incubation_Review_results", component: Incubation_Review_results,

            },
            {
              path: "/home/Incubation/Incubation_Settlement_agreement", component: Incubation_Settlement_agreement,

            },
            {
              path: "/home/Incubation/Incubation_Withdrawal_application", component: Incubation_Withdrawal_application,

            },
            {
              path: "/home/Incubation/Incubation_Tutor_application", component: Incubation_Tutor_application,

            },
          ]

        },
        //日常
        {
          path: "/home/Daily", component: Daily, redirect: "/home/Daily/Daily_Material_Dpplication",
          children: [
            {
              path: "/home/Daily/Daily_Material_Dpplication", component: Daily_Material_Dpplication
            },
            {
              path: "/home/Daily/Daily_Conference_Room_Dpplication", component: Daily_Conference_Room_Dpplication
            },
            {
              path: "/home/Daily/Daily_Repair_Application", component: Daily_Repair_Application
            },
            {
              path: "/home/Daily/Daily_Activity_Management", component: Daily_Activity_Management,
            },
            {
              path: "/home/Daily/Daily_Activity_Management/Daily_Activity_Management_Detailed", component: Daily_Activity_Management_Detailed
            },
            {
              path: "/home/Daily/Daily_Award_Collection", component: Daily_Award_Collection
            },
            {
              path: "/home/Daily/Daily_Feedback", component: Daily_Feedback
            },
          ]
        },
        //团队
        {
          path: "/home/Team", component: Team,
          redirect: "/home/Team/Teaminformation",
          children: [
            {
              //团队信息
              path: "/home/Team/Teaminformation", component: Team_information,
            },
            {
              //视频讲座
              path: "/home/Team/Team_Video_lectures", component: Team_Video_lectures
            },
            {
              //比赛查询
              path: "/home/Team/Team_Match_the_query", component: Team_Match_the_query
            },
            {
              //孵化社区
              path: "/home/Team/Team_Incubation_community", component: Team_Incubation_community

            },
            {
              path: "/home/Team/Team_Incubation_community/Blog_details", component: Team_Incubation_community_Blog_details

            },
            {
              path: "/home/Team/Team_Incubation_community/history", component: Team_Incubation_community_historic_records

            },
            {
              path: "/home/Team/Team_Incubation_community/publish", component: Team_Incubation_community_publish

            },
            {
              //两创教师咨询
              path: "/home/Team/Team_Teacher_counsel", component: Team_Teacher_counsel
            },
            {
              //公司注册
              path: "/home/Team/Team_Company_registry", component: Team_Company_registry
            },
            {
              //跳蚤市场
              path: "/home/Team/Team_Flea_market", component: Team_Flea_market
            },
            {
              //新建团队
              path: "/home/Team/Team_Create_new_team", component: Team_Create_new_team
            }
          ]
        },

        //考核
        {
          path: "/home/check", component: Check, redirect: "/home/check/check_upload",
          children: [
            {
              path: "/home/check/check_upload", component: Check_upload
            },

          ]
        },

      ]
    },
  ]
})


router.beforeEach((to, form, next) => {
  const token = localStorage.getItem("token");
  if (to.name !== "Login" && !token && to.name !== "forgetMM") next({ name: "Login" })
  else next()
})

export default router

